Changing name, data type and initial value of a declared variable
How to change the name, the data type and the initial value of a variable already declared within a →graphical editor:
-
Make the list of declared variables visible. Alternative for an →input variable, →output variable or →in-/out variable: Open the interface editor for the object (from within the project explorer).
-
In this list, point to name of the variable and double-click.
Alternative: Use the command Edit Variable... provided within the context menu or press the Alt+Ctrl+E, if the variable is selected. -
In the dialog, change the following properties for the variable and click OK.
-
name – The name must be an →IEC-identifier.
-
→data type or →function block type
Multi-dimensional array data types are not supported for connecting to a block in-/output with a →generic data type (e.g. the in-/output of theMOVE
block).
Enter one or several letters so that a selection list with the corresponding data types and function blocks is provided.
Subsequent changes to the selection are possible, e.g. by completing an →ARRAY declaration. For theSTRING
data type,STRING[80]
is automatically entered. Overwrite80
, if you need a different length for theSTRING
variable. -
→initial value (only optional required) – This initial value may be a →constant expression (in compliance with the →data type).
It is not possible to assign an initial value to an →external variable
-
Mind the following: In case of a changed name and if this variable is already used, the corresponding code is refactored:
-
All usages of an internal or external variable in the current object are automatically renamed to the new name.
-
All usages of an input or output variable in the objects (e.g. ST-/FBD-objects) of the current project are automatically renamed to the new name. Subsequently, the command Undo in an ST-object might cause a faulty code (see troubleshooting article "Call in ST-code is suddenly fault, after 'Undo' has been called" for more details).
Restriction for renaming a global or external variable The corresponding counterpart is not automatically renamed. |
Good to know |
---|
Neuron Power Engineer provides the additional possibility to change only the name, the data type or the initial value of the variable. See "Modifying variables" for these possibilities. |